// 导入 router
import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
//二级路由表
export const routesChildren: Array<RouteRecordRaw> = [
    {
        path: "/",
        name: 'newHouse',
        meta: {
            title: "新房",
        },
        component: () => import('../pages/newHouse/index.vue'), //.vue不能省略
    },
    {
        path: "/nearby",
        name: "nearby",
        meta: {
            title: "附近",
        },
        component: () => import('../pages/nearby/index.vue'), //.vue不能省略
    },
    {
        path: "/discover",
        name: "discover",
        meta: {
            title: "发现",
        },
        component: () => import('../pages/discover/index.vue'), //.vue不能省略
    },
    {
        path: "/tool",
        name: "tool",
        meta: {
            title: "工具",
        },
        component: () => import('../pages/tool/index.vue'), //.vue不能省略
    },
    {
        path: "/my",
        name: "my",
        meta: {
            title: "我的",
        },
        component: () => import('../pages/my/index.vue'), //.vue不能省略
    }
]
//一级路由表
const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: 'home',
        component: () => import('../pages/home/index.vue'), //.vue不能省略
        children: routesChildren
    }
]
// 配置router对象
const router = createRouter({
    history: createWebHistory(),
    routes
})
export default router